package team.unstudio.unknownrpg_base.attribute;

import java.util.Map;

import indi.defoliation.unknownrpg.api.SerializeHelper;
import indi.defoliation.unknownrpg.api.attribute.Attribute;
import indi.defoliation.unknownrpg.api.attribute.NumberAttribute;

public class CritAttribute extends Attribute implements NumberAttribute<Integer>{
	
	private int crit;
	
	public CritAttribute(int crit) {
		this.set(crit);
	}

	@Override
	public Map<String, Object> serialize() {
		return SerializeHelper.serialize(getKeyName(), crit);
	}

	@Override
	public void add(Integer t) {
		this.crit+=t;
	}

	@Override
	public Integer get() {
		return this.crit;
	}

	@Override
	public void set(Integer t) {
		this.crit=t;
	}

	@Override
	public String getKeyName() {
		return "Crit";
	}

	@Override
	public String getDisplayName() {
		return "暴击";
	}

	@Override
	public void deserialize(Map<String, Object> map) {
		this.crit=(Integer)map.get(getKeyName());
	}
	
	@Override
	public Attribute getAttribute() {
		return this;
	}

}
